package cn.itcast.solr;

import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.HttpSolrServer;
import org.junit.Test;

import java.io.IOException;
import java.lang.reflect.Array;
import java.util.Arrays;

public class SolrDelete {

    @Test
    public void testDelete() throws IOException, SolrServerException {

        // 初始化solr服务
        HttpSolrServer solrServer = new HttpSolrServer("http://localhost:8080/solr/core2");

        // 执行删除操作
        // solrServer.deleteById("6");
        // solrServer.deleteById(Arrays.asList("4", "5"));
        solrServer.deleteByQuery("id:3");

        // 提交
        solrServer.commit();
    }
}
